import { BasicColumn, FormSchema } from '/@/components/Table';
import dayjs from 'dayjs';
import lodash from 'lodash';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
import { render } from '/@/utils/common/renderUtils';

export const columns: BasicColumn[] = [
  {
    title: '日志时间',
    align: 'center',
    dataIndex: 'timestamp',
    width: 200,
  },
  {
    title: '查询语句',
    align: 'center',
    dataIndex: 'query_str',
    //customRender: ({ text }) => render.renderHtmlEllipsis(text),
  },
  {
    title: '查询时间',
    align: 'center',
    width: 120,
    dataIndex: 'query_time',
  },
  {
    title: '锁等待时间',
    align: 'center',
    width: 100,
    dataIndex: 'lock_time',
  },
  {
    title: '返回行数',
    align: 'center',
    width: 80,
    dataIndex: 'rows_sent',
  },
  {
    title: '优化器扫描行数',
    align: 'center',
    width: 120,
    dataIndex: 'rows_examined',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'queryField',
    component: 'Select',
    label: '查询类型',
    defaultValue: '_all',
    componentProps: {
      options: [
        { value: '_all', label: '全文搜索' },
        { value: 'query_str', label: '查询语句' },
      ],
    },
    colProps: {
      span: 6,
    },
  },
  {
    field: 'queryValue',
    label: '查询类型值',
    component: 'Input',
    colProps: { span: 6 },
  },
];
